﻿using UnityEngine;
using System.Collections;

public class CameraScript : MonoBehaviour {

	public GameObject FocusObject;
	public float offset =0.1f;


	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {

	}


	void FixedUpdate(){

	}

	void OnTriggerStay2D(Collider2D other) {
		if (other.gameObject==FocusObject)
		{
			var newPosition	=	Camera.main.transform.position;

			if (newPosition.x < 	FocusObject.transform.position.x)
			{
				newPosition.x 	= 	FocusObject.transform.position.x;
				Camera.main.transform.position=newPosition;
			}
		}
	}

}
